//
//  NSArrayRFAAdditions.m
//  RFA Manager
//
//  Created by Torsten Kammer on 26.03.08.
//  Copyright 2008 __MyCompanyName__. All rights reserved.
//

#import "NSArrayRFAAdditions.h"


@implementation NSArray (RFAAdditions)

- (NSArray *)arrayByRemovingFirstObject;
{
	return [self subarrayWithRange:NSMakeRange(1, self.count - 1)];
}

- (NSString *)commonPrefixWithOptions:(NSStringCompareOptions)mask
{
	NSString *result = nil;
	for (NSString *child in self)
	{
		if (![child isKindOfClass:[NSString class]])
			[NSException raise:NSInternalInconsistencyException format:@"All elements of array have to be NSString for commonPrefix."];
		if (result == nil) result = child;
		else result = [child commonPrefixWithString:result options:mask];
	}
	return result;
}

@dynamic firstObject;
- (id)firstObject
{
	return [self objectAtIndex:0];
}

@end
